package com.cskaoyan.exception;

import com.cskaoyan.bean.BaseRespVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ValidationControllerAdvice {

    @ExceptionHandler(ValidationException.class)
    public BaseRespVo validation(ValidationException exception) {
        String message = exception.getMessage();
        return BaseRespVo.validFail(message);
    }
}
